

/*
 *	DatePicker 
 */
$(function() {
	$( "#LoanCreated" ).datepicker({
		showOtherMonths: true,
		selectOtherMonths: true,
		dateFormat: 'yy-mm-dd'
	});
	
	$( "#LoanEstimatedDevolution" ).datepicker({
		showOtherMonths: true,
		selectOtherMonths: true,
		dateFormat: 'yy-mm-dd'
	});
});


$(function() {
	$( "button, input:submit, .actions a" ).button();
	$( "#dialog" ).dialog({
		modal: true,
		buttons: {
			Ok: function() {
				$( this ).dialog( "close" );
			}
		}
	});
	$( ".column" ).sortable({
		connectWith: ".column"
	});

	$( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
		.find( ".portlet-header" )
			.addClass( "ui-widget-header ui-corner-all" )
			.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
			.end()
		.find( ".portlet-content" );

	$( ".portlet-header .ui-icon" ).click(function() {
		$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
		$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
	});

	$( ".column" ).disableSelection();

});

$(function() {
	$( ".search-form" ).dialog({
		autoOpen: false,
		modal: true,
		resizable: false
	});
});


$(document).ready(function(){
	// toggle the search form
	$('.search-toggle').button().click(function() {
		$( ".search-form" ).dialog( "open" );
	});

});

/**
 * Mecanismo para esconder widgets
 */
$(function() {
	$( "#accordion" ).accordion();
});

/**
 * Tabs para telas com master/detail 
 */
$(function() {
	$( "#detail" ).tabs();
});